Skip to content

CLN: Consistent imports - linting rules #29318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

SaturnFromTitan
Copy link
Contributor

invgrep -R --include="*.py*" -E "from pandas.core.common import" pandas
invgrep -R --include="*.py*" -E "from pandas.core import common" pandas
invgrep -R --include="*.py*" -E "from collections.abc import" pandas
invgrep -R --include="*.py*" -E "from numpy import nan" pandas
Copy link
Contributor Author

@SaturnFromTitan SaturnFromTitan Nov 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the trailing spaces in the import strings to make them more robust to multi-line imports.
Also for the from numpy import nan import they didn't make sense at all. It doesn't seem to be valid syntax anymore though, so it doesn't require any additional clean up

invgrep -R --include="*.py*" -E "from collections.abc import " pandas
invgrep -R --include="*.py*" -E "from numpy import nan " pandas
invgrep -R --include="*.py*" -E "from pandas.core.common import" pandas
invgrep -R --include="*.py*" -E "from pandas.core import common" pandas
Copy link
Contributor Author

@SaturnFromTitan SaturnFromTitan Nov 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed the pattern from pandas.core import common as com is used in the code base as an alternative to the desired import pandas.core.common as com. Therefore I fixed the existing cases (not a breaking change) and added this linting rule here. Let me know if that's fine with you or if this should rather go into a separate PR 🙂✌️

@SaturnFromTitan SaturnFromTitan changed the title Consistent imports util testing linting CLN: Consistent imports - linting rules Nov 1, 2019
@jreback jreback added the Code Style Code style, linting, code_checks label Nov 1, 2019
@jreback jreback added this to the 1.0 milestone Nov 1, 2019
@jreback jreback merged commit 75410f8 into pandas-dev:master Nov 1, 2019
@jreback
Copy link
Contributor

jreback commented Nov 1, 2019

thanks @SaturnFromTitan very nice!

Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLN: Consistent imports in tests: pandas.util.testing as tm
2 participants